package com.eascs.web.o2o.report.task;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.eascs.app.log.Logger;
import com.eascs.app.log.LoggerFactory;
import com.eascs.common.util.StopWatch;
import com.eascs.web.o2o.report.service.BuildEmailService;
import com.eascs.web.o2o.report.service.BuildExcelService;

@Component("monthReportTask")
public class MonthReportTask {
	protected final Logger logger = LoggerFactory.getLogger(getClass());
	
	@Autowired
	BuildExcelService  buildExcelService;
	@Autowired
	BuildEmailService buildEmailService;
	
	
	
	//Seconds Minutes Hours DayofMonth Month DayofWeek Year或 Seconds Minutes Hours DayofMonth Month DayofWeek 
	
	
	
	
	//@Scheduled(cron = "0 00 01 3 * ?")
	public void creditManagerRankReport() {
		logger.info("生成省区信贷经理贷款投放统计及排名任务开始......");
			StopWatch stopWatch = new StopWatch();
			buildExcelService.creditManagerRankReport();
		logger.info("生成省区信贷经理贷款投放统计及排名任务结束，共耗时：[{}]分" , stopWatch.elapsedTime() / 1000 / 60 );
	}
	
	//@Scheduled(cron = "0 00 08 3 * ?")
	public void creditManagerRankMail() {
		logger.info("生成省区信贷经理贷款投放统计及排名任务开始......");
			StopWatch stopWatch = new StopWatch();
			buildEmailService.creditManagerRankMail();
		logger.info("生成省区信贷经理贷款投放统计及排名任务结束，共耗时：[{}]分" , stopWatch.elapsedTime() / 1000 / 60);
	}
	
	
	//全国
	//@Scheduled(cron = "0 00 02 3 * ?")
	public void provinceBusinessRankReport() {
		logger.info("生成全国各省区贷款投放排名任务开始......");
			StopWatch stopWatch = new StopWatch();
			buildExcelService.provinceBusinessRankReport();
		logger.info("生成全国各省区贷款投放排名任务结束，共耗时：[{}]分" ,stopWatch.elapsedTime() / 1000 / 60);
	}
	
	//@Scheduled(cron = "0 20 08 3 * ?")
	public void provinceBusinessRankMail() {
		logger.info("生成全国各省区贷款投放排名邮件任务开始......");
			StopWatch stopWatch = new StopWatch();
			 buildEmailService.provinceBusinessRankMail();
		logger.info("生成全国各省区贷款投放排名邮件任务结束，共耗时：[{}]" ,stopWatch.elapsedTime() / 1000 / 60);
	}
		
}
